<template>
  <div class="myHomeHot center">
    <!-- 首页人气推荐 -->
    <my-title name="人气推荐" desc="人气爆款 不容错过"></my-title>
    <div class="items">
      <div class="item" v-for="item in hotData" :key="item.id">
        <my-card
          :img="item.picture"
          :name="item.title"
          :desc="item.alt"
          background="#fff"
          padding="0 0 20px"
          imgHeight="306px"
          namePadding="10px 30px 0"
          to="/"
        ></my-card>
      </div>
    </div>
  </div>
</template>
<script>
import { ref, reactive, toRefs, computed } from "vue";
import { useRouter, useRoute } from "vue-router";
import { useStore } from "vuex";
import myTitle from "@/components/communal/myTitle.vue";
import myCard from "@/components/communal/myCard.vue";
import { getHomeHot } from "@/api/home/home";
export default {
  props: {},
  name: "myHomeHot",
  setup(props, ctx) {
    /* 定义仓库 */
    const store = useStore();
    /* 定义路由传参 */
    const router = useRouter();
    /* 定义路由收参 */
    const route = useRoute();
    /* 定义总数据存放地址 */
    const data = reactive({
      hotData: [],
    });
    getHomeHot().then((res) => {
      //   console.log(res);
      data.hotData = res.result;
    });
    return { ...toRefs(data) };
  },
  components: {
    myTitle,
    myCard,
  },
};
</script>
<style lang="scss" scoped>
/* 如果不想样式污染  就加个scoped */
.myHomeHot {
  width: 1240px;
  margin: 0 auto;
  background-color: #fff;
  .items {
    display: flex;
    justify-content: space-between;
    .item {
      width: 306px;
    }
  }
  padding-bottom: 30px;
}
</style>